<div style=" margin-top : 80px;"> 选择杯赛淘汰赛
<select name="select-league" id="select-league">
<?php foreach($this->cups as $cup){?>
  <option value ="<?php echo $cup->id ?>"
          <?php if($this->actuel_cup_id ==$cup->id){
          	    echo 'selected="selected"';
          }?>><?php echo $cup->name ?></option>
 <?php }?>
</select>

</div>
<div style="text-align: center; font-weight:bold;margin: 30px;width:600px;font-size:24px;"><?php echo $this->actuel_cup_name;?></div>
<div style="width : 700px; overflow : auto">
<div style="width : <?php echo 300*$this->round; ?>px;">
<?php 
$ecart_first[1] = 0;
$ecart_first[2] = 35;
$ecart_first[3] = 107;
$ecart_first[4] = 250;
$ecart_first[5] = 530;
$ecart[1] = 20;
$ecart[2] = 90;
$ecart[3] = 230;
$ecart[4] = 510;
$ecart[5] = 0;
$first_4 = true;
foreach($this->games as $games){?>
	<div style="width : 300px;float : left">
		<?php if($this->cup->type=='single'){
		        foreach($games as $game){ ?>
						<div style="clear: both; margin : <?php echo $ecart_first[$game['round']] ?>px 0 <?php 
						         if($game['round']==4&&$this->cup->team_count==32&&$first_4)
								 {								   
								   echo $ecart[$game['round']] ;
								   $first_4=false;
								   $ecart[4]="";
								 }else if($game['round']==4&&$this->cup->team_count==32){
								    echo 0 ;
								}else if($game['round']==4&&$this->cup->team_count==16){
								    echo 0;
								}else{
								     echo $ecart[$game['round']] ;
									 }
								
								?>px 0;height: 50px;">
						     <div style="float :left;width : 150px;border : 1px solid white;height:20px;overflow: hidden;"><?php echo $game['away_team_name'] ?></div>
							 <div style="float :left;width : 30px;border : 1px solid white;font-weight : bold;height:20px;"><?php echo ($game['away_team_confirm']=='yes'&&$game['home_team_confirm']=='yes')?$game['away_team_score'] : ''; ?></div>
							 <div style="clear: both;float :left;width : 150px;border : 1px solid white;height:20px;overflow: hidden;"><?php echo $game['home_team_name'] ?></div>
							 <div style="float :left;width : 30px;border : 1px solid white; font-weight : bold;height:20px;"><?php echo ($game['away_team_confirm']=='yes'&&$game['home_team_confirm']=='yes')?$game['home_team_score'] : ''?></div>
						</div>
		<?php } }
		     else{
			 $i = 0;
			 $size = sizeof($games);
			 
			 for($i = 0; $i < $size;$i = $i+2){ ?>
						<div style="clear: both; margin : <?php echo $ecart_first[$games[$i]['round']] ?>px 0 <?php 
						         if($games[$i]['round']==4&&$this->cup->team_count==32&&$first_4)
								 {								   
								   echo $ecart[$games[$i]['round']] ;
								   $first_4=false;
								   $ecart[4]="";
								 }else if($games[$i]['round']==4&&$this->cup->team_count==32){
								    echo 0 ;
								}else if($games[$i]['round']==4&&$this->cup->team_count==16){
								    echo 0;
								}else{
								     echo $ecart[$games[$i]['round']] ;
									 }
								
								?>px 0;height: 50px;">
						     <div style="float :left;width : 150px;border : 1px solid white;height:20px;overflow: hidden;"><?php echo $games[$i]['away_team_name'] ?></div>
							 <div style="float :left;width : 30px;border : 1px solid white;height:20px;"><?php echo ($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes')?$games[$i]['away_team_score'] : ''; ?></div>
							  <div style="float :left;width : 30px;border : 1px solid white;height:20px;"><?php echo ($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes')?$games[$i+1]['home_team_score'] : ''; ?></div>
							  <div style="float :left;width : 30px;border : 1px solid white;font-weight : bold;height:20px;"><?php 
							  if(($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes')&&
							     ($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes') ){
						           echo $games[$i+1]['home_team_score']+$games[$i]['away_team_score'];
							   }else if($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes'){
							       echo $games[$i]['away_team_score'];
							   }else if($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes'){
							       echo $games[$i+1]['home_team_score'];
							   }else{
							      echo '';
							   }
								 
							 ?></div>
							  
							 <div style="clear: both;float :left;width : 150px;border : 1px solid white;height:20px;overflow: hidden;"><?php echo $games[$i]['home_team_name'] ?></div>
							 <div style="float :left;width : 30px;border : 1px solid white; height:20px;"><?php echo ($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes')?$games[$i]['home_team_score'] : ''?></div>
							 <div style="float :left;width : 30px;border : 1px solid white; height:20px;"><?php echo ($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes')?$games[$i+1]['away_team_score'] : ''?></div>
							 <div style="float :left;width : 30px;border : 1px solid white;font-weight : bold;height:20px;"><?php 
							   if(($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes')&&
							     ($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes') ){
						           echo $games[$i+1]['away_team_score']+$games[$i]['home_team_score'];
							   }else if($games[$i]['away_team_confirm']=='yes'&&$games[$i]['home_team_confirm']=='yes'){
							       echo $games[$i]['home_team_score'];
							   }else if($games[$i+1]['away_team_confirm']=='yes'&&$games[$i+1]['home_team_confirm']=='yes'){
							       echo $games[$i+1]['away_team_score'];
							   }else{
							      echo '';
							   }
							 ?></div>
							 
						</div>
		<?php } 
			     }?>
	</div>
<?php }?>
</div>
</div>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
$(document).ready(function() {
    $('#select-league').change(function(){
        window.location=window.location.pathname + '?cup_id='+$(this).val();

    }
    );

})

//--><!]]>
</script>


         